import request from '@/config/axios'

// 库存 VO
export interface InventoryVO {
  id: string // 主键
  cid: string // 商品id
  count: number // 数量
  location: string // 所在位置区域
  name: string // 商品名
  wid: string // 仓库id
  description: string // 库存记录-描述信息
}

// 库存 API
export const InventoryApi = {
  // 查询库存分页
  getInventoryPage: async (params: any) => {
    return await request.get({ url: `/wms/inventory/page`, params })
  },

  // 查询库存详情
  getInventory: async (id: string) => {
    return await request.get({ url: `/wms/inventory/get?id=` + id })
  },

  // 新增库存
  createInventory: async (data: InventoryVO) => {
    return await request.post({ url: `/wms/inventory/create`, data })
  },

  // 修改库存
  updateInventory: async (data: InventoryVO) => {
    return await request.put({ url: `/wms/inventory/update`, data })
  },

  // 删除库存
  deleteInventory: async (id: string) => {
    return await request.delete({ url: `/wms/inventory/delete?id=` + id })
  },

  // 导出库存 Excel
  exportInventory: async (params) => {
    return await request.download({ url: `/wms/inventory/export-excel`, params })
  },

  // 入库
  inInventory: async (data: InventoryVO) => {
    return await request.put({ url: `/wms/inventory/in`, data })
  },

  // 出库
  outInventory: async (data: InventoryVO) => {
    return await request.put({ url: `/wms/inventory/out`, data })
  },
}
